#include <iostream>
using namespace std;

int a, b, c, x1, y1, x2, y2;

int main()
{
	int ans = 0;
	cin >> a >> b >> c >> x1 >> x2 >> y1 >> y2;
	for (int i = x1; i <= x2; i++)
		for (int j = y1; j <= y2; j++)
			if (a * i + b*j + c == 0) ans++;
	cout << ans << "\n";
}
